package com.atguigu.sort;

import com.atguigu.utils.ArrayGenerator;
import com.atguigu.utils.SortingHelper;
import org.junit.Test;

import java.util.Arrays;

public class BubbleSortTest {

    public static void main(String[] args) {
        int n=100000;
        Integer[] arr1 = ArrayGenerator.generateRandomArray(n, n);
        Integer[] arr2 = Arrays.copyOf(arr1,arr1.length);
        Integer[] arr3 = Arrays.copyOf(arr1,arr1.length);
        Integer[] arr4 = Arrays.copyOf(arr1,arr1.length);
        Integer[] arr5 = Arrays.copyOf(arr1,arr1.length);
        SortingHelper.sortTest("BubbleSort",arr1);
        SortingHelper.sortTest("MergeSort",arr2);
        SortingHelper.sortTest("QuickSort",arr3);
        SortingHelper.sortTest("InsertionSort",arr4);
        SortingHelper.sortTest("SelectionSort",arr5);
    }
    @Test
    public void testBubbleSort2Test(){
        int n=100000;
        Integer[] arr1 = ArrayGenerator.generateRandomArray(n, n);
        Integer[] arr2 = Arrays.copyOf(arr1,arr1.length);
        Integer[] arr3 = Arrays.copyOf(arr1,arr1.length);
        System.out.println("Random Array");
        SortingHelper.sortTest("BubbleSort",arr1);
        SortingHelper.sortTest("BubbleSort2",arr2);
        SortingHelper.sortTest("BubbleSort3",arr3);
        System.out.println();
        arr1=ArrayGenerator.generateOrderArray(n);
        arr2=Arrays.copyOf(arr1,arr1.length);
        arr3=Arrays.copyOf(arr1,arr1.length);
        System.out.println("Order Array");
        SortingHelper.sortTest("BubbleSort",arr1);
        SortingHelper.sortTest("BubbleSort2",arr2);
        SortingHelper.sortTest("BubbleSort3",arr3);
    }
    @Test
    public void test1(){
        Integer[]arr={67,34,90,12,34,67,23,10};
        BubbleSort.sort6(arr);
        System.out.println(Arrays.toString(arr));
    }
}
